package com.leyou.web;

import com.leyou.common.pojo.PageResult;
import com.leyou.search.pojo.Goods;
import com.leyou.search.pojo.SearchRequest;
import com.leyou.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Rose
 * @Date: 2021/4/3 13:40
 * @description ${description}
 * @version: 1.0.0
 */
@RestController
public class SearchController {

    @Autowired
    private SearchService searchService;


    /**
     * 搜索功能
     *
     * @param request
     * @return
     */
    @PostMapping("page")
    public ResponseEntity<PageResult<Goods>> search(@RequestBody SearchRequest request) {
        PageResult<Goods> pageResult = this.searchService.search(request);
        return ResponseEntity.ok(pageResult);
    }


}
